package com.daikit.commons.shared.utils;

/**
 * Utility class for mathematical functions
 * 
 * @author tcaselli
 * @version $Revision$ Last modifier: $Author$ Last commit: $Date$
 */
public class DkMathUtils
{

	/**
	 * Wrapper to {@link #rand(int, int)} with minIncluded = 0
	 * 
	 * @param maxIncluded
	 *           the max included value
	 * @return a random int between 0 and maxIncluded
	 */
	public static final int rand(final int maxIncluded)
	{
		return rand(0, maxIncluded);
	}

	/**
	 * Get a random int between given values
	 * 
	 * @param minIncluded
	 *           the min included value
	 * @param maxIncluded
	 *           the max included value
	 * @return a random int between minIncluded and maxIncluded
	 */
	public static final int rand(final int minIncluded, final int maxIncluded)
	{
		return minIncluded + (int) Math.floor(Math.random() * (maxIncluded - minIncluded + 0.9999999d));
	}

}
